#include<iostream>
#include<vector>

using namespace std;

int compareVersion(string version1, string version2) {
    auto v1 = version(version1);
    auto v2 = version(version2);
    int len = max(v1.size(), v2.size());
    v1.resize(len), v2.resize(len);

    for (int i = 0; i < len; i++)
        if (v1[i] < v2[i])   return -1;
        else if (v1[i] > v2[i])  return 1;
    return 0;
}

vector<int> version(string s)
{
    vector<int> res;
    while (s.find('.') != s.npos)
    {
        auto it = s.find('.');
        res.push_back(atoi(s.substr(0, it + 1).c_str()));
        s = s.substr(it + 1);
    }
    res.push_back(atoi(s.c_str()));
    return res;
}